package com.zt.service.impl;

import com.zt.mapper.EmpMapper;
import com.zt.pojo.CountData;
import com.zt.pojo.JobOption;
import com.zt.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ReportServiceImpl implements ReportService {
    @Autowired
    private EmpMapper empMapper;

    @Override
    public JobOption getEmpJobData() {
        List<Map<String,Object>> list = empMapper.getEmpJobData();
        List<Object> jobList = list.stream().map(dataMap -> dataMap.get("pos")).toList();
        List<Object> dataList = list.stream().map(dataMap -> dataMap.get("total")).toList();
        return new JobOption(jobList, dataList);
    }

    @Override
    public List<Map<String, Object>> getStudentDegreeData() {
        List<Map<String, Object>> degreeList = empMapper.getStudentDegreeData();
        return degreeList;
    }

    @Override
    public CountData getStudentCountData() {
        //查询
        List<Map<String, Object>> empList = empMapper.getstudentData();
        List clazzList = empList.stream().map(dataMap -> dataMap.get("clazzList")).toList();
        List dataList = empList.stream().map(dataMap -> dataMap.get("dataList")).toList();
        return new CountData(clazzList, dataList);
    }

    @Override
    public List<Map<String, Object>> getempGenderDate() {
       List<Map<String, Object>> genderlist = empMapper.getempGenderDate();
        return genderlist;
    }


}
